package com.ruoyi.finance.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.finance.domain.PaymentVoucher;
import com.ruoyi.finance.domain.vo.PaymentVoucherLogVo;
import com.ruoyi.finance.domain.vo.PaymentVoucherVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface PaymentVoucherMapper extends BaseMapper<PaymentVoucher> {

    /**
     * 通过最新的时间来查询付款单号
     * @return
     */
    public String selectPaymentMasterCode();
    /**
     * 查询付款单列表
     */
    List<PaymentVoucherVo> selectPaymentVoucherList(PaymentVoucherVo paymentVoucher);
    /**
     * 查询日志
     */
    List<PaymentVoucherLogVo> selectPaymentVoucherLogList(PaymentVoucherLogVo paymentVoucherLog);
    /**
     * 通过付款申请ID查询付款凭证
     */
    PaymentVoucherVo selectByPaymentRequestId(String requestId);
    /**
     * 判断某采购订单是否已全部付款（全部上传水单且付款金额一致）
     * @param procuredOrderId 采购订单ID
     * @return true：已全部付款，false：未全部付款
     */
    Boolean isFullyPaid(@Param("procuredOrderId") String procuredOrderId);
    /**
     * 查询该主表下所有付款单的状态
     */
    List<String> selectVoucherStatusesByMasterId(String paymentMasterId);
    /**
     * 判断某采购订单是否已全部付款（不校验水单，付款金额一致）
     * @param procuredOrderId 采购订单ID
     * @return true：已全部付款，false：未全部付款
     */
    Boolean isFullyPaidNotWaterBill(@Param("procuredOrderId") String procuredOrderId);
}
